<?php $this->extend('comm/page');?>

<style>
    .layui-table-cell {
        height: auto;
        white-space: normal;
    }
</style>

<div class="panel panel-default panel-intro">
    <?php echo $this->build_heading(); ?>

    <div class="panel-body">
        <!-- 搜索 -->
        <div id="search" class="row">
            <form class="layui-form" lay-filter="search">
                <div class="col-xs-12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">名称：</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">状态：</label>
                        <div class="layui-input-block">
                            <select name="status" lay-filter="status">
                                <option value=""></option>
                                <option value="1">有效</option>
                                <option value="2">无效</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6 col-md-3 hidden-xs">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">创建时间：</label>
                        <div class="layui-input-block">
                            <input type="text" name="search_time" class="layui-input date-range">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo $this->build_toolbar(['refresh', 'add', 'search']); ?>
        </div>
        <table id="table" lay-filter="table" class="mr-b-sm"></table>
    </div>
</div>

<!-- 操作 -->
<script type="text/html" id="operate">
    <?php if($this->checkAuth('/admin/chat/app/status', $userInfo['id'])): ?>
<button type="button" class="btn btn-xs btn-danger" lay-event="status"><i class="fa fa-eye"> 应用状态</i></button>
<?php endif; ?>
<?php if($this->checkAuth('/admin/chat/app/info', $userInfo['id'])): ?>
<button type="button" class="btn btn-xs btn-success" lay-event="info"><i class="fa fa-eye"> 应用代码</i></button>
<?php endif; ?>
<?php if($this->checkAuth('/admin/chat/app/edit', $userInfo['id'])): ?>
<button type="button" class="btn btn-xs btn-primary" lay-event="edit"><i class="fa fa-pencil"> 编辑应用</i></button>
<?php endif; ?>
<?php if($this->checkAuth('/admin/chat/history', $userInfo['id'])): ?>
<button type="button" class="btn btn-xs btn-info" lay-event="history"><i class="fa fa-list-alt"> 通信记录</i></button>
<?php endif; ?>
</script>